package com.manlitech.cloudboot.oauth.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shensg
 * @date 2021/7/7 17:22
 */
@RestController
public class HelloController {
    
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }

    // 登录成功首页
    @PostMapping("/success")
    public String login() {
        /*
         * 后期这里设置生产jwt
         * */
        System.out.println("登录成功首页");
        return "登录成功首页";
    }

    //增加用户
    @PostMapping("/add")
    @Secured({"ROLE_asiaPacificGroupLeader"})//角色  专门用于判断是否具有角色，能写在方法或者类上，参数要以ROLE_ 开头
    public String add(){
        System.out.println("增加用户");
        return "增加用户";
    }
    //删除用户
    @PostMapping("/delete")
    @Secured({"ROLE_asi"})   //角色
    public String delete(){
        System.out.println("删除用户");
        return "删除用户";
    }
    //编辑用户
    @PostMapping("/edit")
    @PreAuthorize("hasAnyAuthority('leader')")   //权限
    public String edit(){
        System.out.println("编辑用户");
        return "编辑用户";
    }
    //查找用户
    @PostMapping("/select")
    @PreAuthorize("hasAnyAuthority('asiaPa')")    //权限
    public String orderList(){
        System.out.println("查找用户");
        return "查找用户";
    }
    //观看用户
    @PostMapping("/find")
    public String find(){
        System.out.println("观看用户");
        return "观看用户";
    }
}
